<html>
<head>
  <title>reduce.py</title>
</head>
<body bgcolor="#ffffff" text="#000000">
<pre>
<strong>import</strong> <font color="#2040a0">sys</font>,<font color="#2040a0">mpi</font>
<font color="#2040a0">rank</font>,<font color="#2040a0">size</font> <font color="4444FF">=</font> <font color="#2040a0">mpi</font>.<font color="#2040a0">init</font><font color="4444FF">(</font><font color="#2040a0">len</font><font color="4444FF">(</font><font color="#2040a0">sys</font>.<font color="#2040a0">argv</font><font color="4444FF">)</font>,<font color="#2040a0">sys</font>.<font color="#2040a0">argv</font><font color="4444FF">)</font>
<font color="#2040a0">sigma</font> <font color="4444FF">=</font> <font color="#2040a0">mpi</font>.<font color="#2040a0">reduce</font><font color="4444FF">(</font> <font color="#FF0000">7</font>, <font color="#FF0000">1</font>, <font color="#2040a0">mpi</font>.<font color="#2040a0">MPI_INT</font>, <font color="#2040a0">mpi</font>.<font color="#2040a0">MPI_SUM</font>, <font color="#FF0000">0</font>, <font color="#2040a0">mpi</font>.<font color="#2040a0">MPI_COMM_WORLD</font> <font color="4444FF">)</font>
<strong>print</strong> <font color="#008000">&quot;Sum:&quot;</font>,<font color="#2040a0">sigma</font> 
<font color="#2040a0">mpi</font>.<font color="#2040a0">finalize</font><font color="4444FF">(</font><font color="4444FF">)</font>

</pre>
<hr>
syntax highlighted by <a href="http://www.palfrader.org/code2html">Code2HTML</a>, v. 0.9.1
</body>
</html>
